package com.amigo.online.provider.manager.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.amigo.online.common.base.service.BaseService;
import com.amigo.online.provider.manager.mapper.AdvHomeSourceTblMapper;
import com.amigo.online.provider.manager.model.entity.AdvHomeSourceTbl;
import com.amigo.online.provider.manager.service.AdvHomeSourceTblService;

@Service
public class AdvHomeSourceTblServiceImpl extends BaseService<AdvHomeSourceTbl> implements AdvHomeSourceTblService {

    @Resource
    private AdvHomeSourceTblMapper advHomeSourceTblMapper;

    @Override
    public List<AdvHomeSourceTbl> findAdvHomeSourceList(Long advId) {
        return advHomeSourceTblMapper.findAdvHomeSourceList(advId);
    }

    @Override
    public boolean saveAdvHomeSourceTbl(AdvHomeSourceTbl advHomeSourceTbl) {
        advHomeSourceTbl.setCreatedTime(System.currentTimeMillis() / 1000);
        if (advHomeSourceTblMapper.saveAdvHomeSourceTbl(advHomeSourceTbl) <= 0) {
            return false;
        } else {
            return true;
        }
    }

    @Override
    public boolean updateAdvHomeSourceTbl(AdvHomeSourceTbl advHomeSourceTbl) {
        advHomeSourceTbl.setUpdatedTime(System.currentTimeMillis() / 1000);
        if (advHomeSourceTblMapper.updateAdvHomeSourceTbl(advHomeSourceTbl) <= 0) {
            return false;
        } else {
            return true;
        }
    }

    @Override
    public boolean deleteAdvHomeSourceTbl(AdvHomeSourceTbl advHomeSourceTbl) {
        advHomeSourceTbl.setDeleted(1);
        advHomeSourceTbl.setDeletedTime(System.currentTimeMillis() / 1000);
        if (advHomeSourceTblMapper.deleteAdvHomeSourceTbl(advHomeSourceTbl) <= 0) {
            return false;
        } else {
            return true;
        }
    }

}
